package main

import (
	"fmt"
	"gitee.com/chenwl888/gotools/utils/pprof"
	"time"
)

// 这是一个检查函数开销的程序
//go tool pprof http://localhost:8080/debug/pprof/profile  默认采集需要30秒
//go tool pprof http://localhost:8080/debug/pprof/heap
//go tool pprof http://localhost:8080/debug/pprof/block
//go tool pprof http://localhost:8080/debug/pprof/mutex
// web可视化方式
//go tool pprof -http=:8000 http://localhost:8080/debug/pprof/heap    查看内存使用
//go tool pprof -http=:8000 http://localhost:8080/debug/pprof/profile 查看cpu占用
// 10分钟采样测试       go tool pprof -http=:8000 -seconds=600 http://localhost:8080/debug/pprof/profile
func funTest() {
	for {
		time.Sleep(3 * time.Second)
		fmt.Println("funTest----------------------------")
	}
}
func main() {

	pprof.Init("8080")

	go func() {
		funTest()
	}()

	fmt.Println("Waiting for 10 minutes...")
	time.Sleep(10 * time.Minute)
	fmt.Println("Exiting...")
}
